package com.xidian.zhiancloud.service.helpCenter;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xidian.zhiancloud.dao.CommonProblemMapper;
import com.xidian.zhiancloud.dao.SysMenuMapper;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.exception.CustomizeException;
import com.xidian.zhiancloud.model.CommonProblem;
import com.xidian.zhiancloud.model.SysMenu;
import com.xidian.zhiancloud.model.syset.Organization;
import com.xidian.zhiancloud.model.syset.SysUser;
import com.xidian.zhiancloud.qo.helpCenter.CommonProblemQO;
import com.xidian.zhiancloud.vo.emergencyManagement.EmergencyTeamManagementVO;
import com.xidian.zhiancloud.vo.helpCenter.CommonProblemVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommonProblemService extends ServiceImpl<CommonProblemMapper, CommonProblem> implements IService<CommonProblem> {
    @Autowired
    private CommonProblemMapper commonProblemMapper;

    public CommonProblem getById(Long id) {
        CommonProblem commonProblem = commonProblemMapper.selectById(id);
        if (commonProblem == null) {
            throw new CustomizeException(GeneralResponseEnums.GET_FAILED);
        }
        return commonProblem;
    }

    public IPage<CommonProblem> getListByQO(CommonProblemQO commonProblemQO) {
        Page<CommonProblem> page = new Page<>(commonProblemQO.getCurrent(), commonProblemQO.getSize());
        IPage<CommonProblem> ans= commonProblemMapper.getListByQO(page,commonProblemQO);
        return ans;
    }
}
